# Parser makefile

# Make sure we can clean on windows as well
# Disable compile warnings
ifdef SystemRoot
   RM = del /Q /F
   LIBS = ../Scanner-Automat/*.o ../Puffer/Buffer.o ../Symtable/*.o
else
   ifeq ($(shell uname), Linux)
      RM = rm -f
      LIBS = -L../Puffer -L../Symtable -L../Scanner-Automat -lBuffer -lSymtable -lScanner
   endif
endif

CXXFLAGS =	-O2 -Wall -c
LDFLAGS =	

SRC =		LE.cpp List.cpp main.cpp Node.cpp NTDecl.cpp NTDecls.cpp NTProg.cpp NTStatements.cpp Parser.cpp ParseTree.cpp Rule.cpp TDummy.cpp
OBJS =		$(SRC:.cpp=.o)
INCS =		$(wildcard *.h)

TARGET =	parser


$(TARGET):	$(OBJS)
	$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

%.o: %.cpp $(INCS)
	$(CXX) $(CXXFLAGS) $< -o $@

debug:	CXX += -DDEBUG -g
debug:	CC += -DDEBUG -g
debug:	all

release:	all

all:	$(SRC) $(TARGET)

.PHONY: clean
clean:
	$(RM) $(OBJS) $(TARGET)
